import { Controller, Post, Body } from '@nestjs/common';
import { Public } from 'src/common/decorators/public.decorator';
import { AuthorizationService } from './authorization.service';
import { SignInDto } from './dto/sign-in';
import { SignUpDto } from './dto/sign-up';
import { ApiTags, ApiOperation } from '@nestjs/swagger';

@Controller('auth')
@ApiTags('身份认证')
export class AuthorizationController {
  constructor(private readonly authorizationService: AuthorizationService) {}

  @Public()
  @ApiOperation({
    summary: '管理员注册',
    description: '一般是超级管理员通过这个添加管理员',
  })
  @Post('/admin/signUp')
  admin_signUp(@Body() signUp: SignUpDto) {
    return this.authorizationService.adminSignUp(signUp);
  }

  @Public()
  @ApiOperation({ summary: '管理员登录', description: '登录获取到token值' })
  @Post('/admin/signIn')
  admin_signIn(@Body() signIn: SignInDto) {
    return this.authorizationService.adminSignIn(signIn);
  }
}
